package com.n1global.serveranalytics;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class ExceptionPayload {
    private String trace;

    private String type;

    private Object payload;

    public void processException(Throwable e, Object payload) {
        ByteArrayOutputStream bout = new ByteArrayOutputStream();

        PrintStream ps = new PrintStream(bout);

        e.printStackTrace(ps);

        trace = bout.toString();

        type = e.getClass().getSimpleName();

        this.payload = payload;
    }

    public String getTrace() {
        return trace;
    }

    public String getType() {
        return type;
    }

    public Object getPayload() {
        return payload;
    }
}
